<template>
  <div class="dashboard-container">

    <el-alert
      :title="msg"
      type="success">
    </el-alert>

    <div class="dashboard-text">欢迎:{{name}}</div>
    <div class="dashboard-text">{{v_avatar}}</div>


  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import {userAvatar} from '@/api/data.js'

export default {
  name: 'dashboard',
  data() {
    return {
      name:'',
      endTime:"",
      msg:'',
      f_avatar:{
        "1":"管理员",
        "0":'普通用户'
      }
    }
  },
  computed: {
    ...mapGetters([
      'userInfo'
    ]),
    v_avatar:function(){
      let nd = parseInt(this.userInfo.avatar);
      return userAvatar(nd)
    }
  },
  mounted(){
    this.anLoad();
  },
  methods:{
    anLoad(){
      this.name = this.userInfo.name;
      this.endTime = this.userInfo.expire_time;
      this.msg = '上次登录时间：'+this.endTime;

    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  @import "../../styles/mixin";
.dashboard {
  &-container {
    margin: 30px;
    .time{
      color:$color-Warning ;
    }
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}

</style>
